package com.airbnb.lottie.animation.keyframe;

import com.airbnb.lottie.model.content.ShapeData;
import com.airbnb.lottie.utils.MiscUtils;
import com.airbnb.lottie.value.Keyframe;

import ohos.agp.render.Path;

import java.util.List;

public class ShapeKeyframeAnimation extends BaseKeyframeAnimation<ShapeData, Path> {
    private final ShapeData tempShapeData = new ShapeData();

    private final Path tempPath = new Path();

    public ShapeKeyframeAnimation(List<Keyframe<ShapeData>> keyframes) {
        super(keyframes);
    }

    @Override
    public Path getValue(Keyframe<ShapeData> keyframe, float keyframeProgress) {
        ShapeData startShapeData = keyframe.startValue;
        ShapeData endShapeData = keyframe.endValue;

        tempShapeData.interpolateBetween(startShapeData, endShapeData, keyframeProgress);
        MiscUtils.getPathFromData(tempShapeData, tempPath);
        return tempPath;
    }
}
